package com.renge.demo;

import com.alibaba.excel.EasyExcel;
import com.renge.eduservice.entity.test.DemoData;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class ExeclDemo {
    @Test
    public void demo01(){
        String fileName="d://student.xlsx";
        List<DemoData>list=new ArrayList<>();
        for (int i=0 ;i<10;i++){
            DemoData demoData = new DemoData();
            demoData.setSname("wgr"+i);
            demoData.setSno(i);
            list.add(demoData);
        }
        EasyExcel.write(fileName, DemoData.class).sheet("学生表").doWrite(list);
    }

    @Test
    public void demo02(){
        String fileName="d://student.xlsx";
        EasyExcel.read(fileName,DemoData.class,new ExeclListen()).sheet().doRead();
    }
}
